package com.googlecode.microanalyst.palette.model.cmd;

import org.eclipse.gef.commands.Command;

import com.googlecode.microanalyst.palette.model.Dataset;

public class DatasetNameCommand extends Command {

	private String newName, oldName;
	private Dataset dataset;

	public DatasetNameCommand(Dataset l, String s) {
		dataset = l;
		if (s != null)
			newName = s;
		else
			newName = ""; //$NON-NLS-1$
	}

	public void execute() {
		oldName = dataset.getName();
		dataset.setName(newName);
	}

	public void undo() {
		dataset.setName(oldName);
	}

}
